﻿/*************************************************
 * 
 *  框架级
 *  
 *  业务操作 - 分页
 * 
 *  create by ternence
 * 
 *  create datetime at 2017-03-17
 *  
 *  西安佳卓信息科技有限公司 ©2017
 * 
 * ***********************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zor_IDAL;
using Zor_Modes;

namespace Zor_DAL
{
    public static class PagerHelp<T> where T : class
    {

        /// <summary>
        /// 分页通用
        /// </summary>
        /// <param name="index">页码</param>
        /// <param name="TableName">表名称</param>
        /// <param name="orderby">排序条件</param>
        /// <param name="TotalCount">返回值</param>
        /// <param name="where">查询条件</param>
        /// <returns></returns>
        public static List<T> GetPagerList(int index,string TableName,string orderby, out int TotalCount,string where = null)
        {
            BasePager pages = new BasePager();
            pages.TableName = TableName;
            pages.Where = where == null ?  "1=1" : where;
            pages.Order = orderby;
            pages.PageSize = 15;
            pages.CurrentCount = (index - 1) * 15;

            return DapperPage<T>.PageList(pages, out TotalCount);
        }
    }
}
